<template>
    <div class="">
        <el-row type="flex" class="row-bg" justify="space-between">
            <!--<el-col :span="12">-->
                <!--<el-button type="primary" size="small" data-id="3" @click="e_userstart">-->
                    <!--<i class="iconfont icon-qiyong"></i>认购审核</el-button>-->
            <!--</el-col>-->
            <el-col :span="6">
                <el-input placeholder="关键字..." size="small" v-model="searchKey">
                    <el-button slot="append" icon="search" @click="loadData"></el-button>
                </el-input>
            </el-col>
        </el-row>
        <template>
            <el-table :data="tableData" border style="width: 100%; text-align: center;margin-top:10px;" v-loading.body="loading" @selection-change="handleSelectionChange">
                <el-table-column type="index" style="width:50%"></el-table-column>
                <el-table-column type="selection"></el-table-column>
                <el-table-column prop="outName" header-align="center" label="会员名称"></el-table-column>
                <el-table-column prop="count" header-align="center" label="总数量"></el-table-column>
                <el-table-column prop="useCount" header-align="center" label="使用数量"></el-table-column>
                <el-table-column prop="phone" header-align="center" label="手机"></el-table-column>
                <el-table-column prop="isTransfer" header-align="center" label="转账类型">
                    <template slot-scope="scope">
                        <span v-text="checkRegType(scope.row.isTransfer)"></span>
                    </template>
                </el-table-column>

                <el-table-column prop="createTime" header-align="center" label="转账时间"></el-table-column>
            </el-table>
            <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage" :page-sizes="[5,10,20,40]" :page-size="limit" layout="total, sizes, prev, pager, next, jumper" :total="total">
            </el-pagination>
        </template>
    </div>
</template>
<script>
	var qs = require('qs')
	import Editor from '../../components/editor.vue'
	import { tokenGet, TokenUrl, tokenPost } from '../../api/token.js'
	export default {
		data() {
			return {
				checked: true,
				tableData: [],
				currentPage: 1,
				radio: {
					radioC: '1', //是否可以充值
					radioT: '1', //是否可以提现
					radioD: '1', //充值是否到账
					radioB: '1', //虚拟币类型
					radioY: '1', //是否以太坊
					radioZ: '1', //状态
				},
				typeNumber: [],
				total: 0,
				limit: 10,
				searchKey: '',
				loading: false,
				jinyong: [], //禁用id
			}
		},
		methods: {
			handleSizeChange(val) {
				console.log(val)
				this.limit = val
				this.loadData()
			},
			handleCurrentChange(val) {
				console.log(val)
				this.currentPage = val
				this.loadData()
			},
			handleSelectionChange(val) {
				this.typeNumber = val
				this.jinyong = val
				console.log(this.typeNumber)
			},
			/**
			 * @Description: ${获取表格数据}
			 * @Param
			 * @Return
			 * @Author 焦政
			 * @Date 2018/11/14
			 * @Version 1.0
			 */
			loadData() {
				this.loading = true;
				let getParams = `${TokenUrl.transferList}?offset=${this.limit*(this.currentPage - 1)}&limit=${this.limit}&searchKey=${this.searchKey}&type=4`
				tokenGet(getParams).then((response) => {
					console.log(response)
					this.tableData = response.data.data.rows;
					this.total = response.data.data.total;
					this.loading = false;
				}, (response) => {

				});
			},
			//会员类型判断
			checkMemberType(s) {
				if (s == 0) {
					return '普通会员'
				} else if (s == 1) {
					return '销售商'
				} else if (s == 2) {
					return '生产商'
				}
			},
			// 是否通过实名
			checkISReal(i) {
				if (i == 0) {
					return '否'
				} else if (i == 1) {
					return '是'
				} else if (i == -1) {
					return '未通过'
				}
			},
			// 是否提交过实名
			checkSubReal(i) {
				if (i == 0) {
					return '否'
				} else if (i == 1) {
					return '是'
				}
			},
			// 注册类型
			checkRegType(t) {
				if (t == 0) {
					return '转账'
				} else if (t == 1) {
					return '兑换'
				}
			},
			// 是否绑定过手机
			checkfisPhone(i) {
				if (i == 0) {
					return '否'
				} else if (i == 1) {
					return '是'
				}
			},
			// 登录方式
			checkLoginType(t){
				if (t == 0) {
					return '前台'
				} else if (t == 1) {
					return '后台'
				}
			},
			checkIsActive(a){
				if(a == 0){
					return '否'
				}else if (a == 1){
					return '是'
				}
			},
			// ============================================表格数据状态类型判断👆==============================================//
			/**
			 * @Description: ${会员启用}
			 * @Param
			 * @Return
			 * @Author 焦政
			 * @Date 2018/11/14
			 * @Version 1.0
			 */
			e_userstart(s){
				if(this.jinyong.length == 0){
					this.$alert('请选择一条记录进行操作')
					return
				}
				if(this.jinyong.length > 1){
					this.$alert('只能选择一条记录进行审核')
					return
				}
				let startParams = {
					rengourecordId:this.jinyong[0].id
				}
				tokenPost(TokenUrl.beauditedReview,startParams).then(re=>{
					if(re.status == 200){
						this.$alert(re.data.msg)
						this.loadData()
					}else{
						this.$alert(re.data.msg)
					}
				})
			},

		},

		//引入文本编辑器那个组件
		components: {
			'v-editor': Editor,
		},
		created() {
			this.loadData()
		},
	}
</script>
<style>
    .el-dialog--small {
        width: 60%;
    }
</style>
